﻿@model MobilesStore.Domain.Entities.Cart
<section id="cart">
          <div class="heading">
            <h4><img width="32" height="32" alt="" src="~/Images/image/cart-bg.png"></h4>
            <a><span id="cart-total">@Model.lines.Count() item(s) - @Model.ComputeTotalValue().ToString("c")</span></a> </div>
          <div class="content">
            <div class="mini-cart-info">
              <table>
                  @foreach(var p in Model.lines)
                  {
                    <tr>
                        @{
                            if(p.Product.ImageData!=null)
                            {
                                <td class="image"><img width="64" height="80" src="@Url.Action("GetImage", "Product", 
                                    new { p.Product.ProductID })" alt="@p.Product.ProductName" title="@p.Product.ProductName" /></td>
                            }else{
                                <td class="image"><img width="64" height="80" src="../../Images/image/product/apple_cinema_30-162x162.jpg" alt="@p.Product.ProductName" title="@p.Product.ProductName" /></td>
                            }
                        }
                      <td class="name">@Html.ActionLink(p.Product.ProductName,"Detail","Product",new{p.Product.ProductID},null)</td>
                      <td class="quantity">x&nbsp;@p.Quantity</td>
                      <td class="total">@Model.ComputeCartlineValue(p).ToString("c")</td>
                      <td class="remove"><img src="~/Images/image/remove-small.png" alt="Remove" title="Remove" /></td>
                    </tr>
                  }
              </table>
            </div>
            <div class="mini-cart-total">
              <table>
                <tr>
                  <td class="right"><b>Sub-Total:</b></td>
                  <td class="right">@Model.ComputeSubValue(0.8f).ToString("c")</td>
                </tr>
                <tr>
                  <td class="right"><b>Eco Tax (2%):</b></td>
                  <td class="right">@Model.ComputeSubValue(0.02f).ToString("c")</td>
                </tr>
                <tr>
                  <td class="right"><b>VAT (18%):</b></td>
                  <td class="right">@Model.ComputeSubValue(0.18f).ToString("c")</td>
                </tr>
                <tr>
                  <td class="right"><b>Total:</b></td>
                  <td class="right">@Model.ComputeTotalValue().ToString("c")</td>
                </tr>
              </table>
            </div>
            <div class="checkout"><span>@Html.ActionLink("View Cart", "Index", "Cart", new { returnUrl = Request.Url.PathAndQuery }, new { @class="button"})</span> &nbsp; <span class="button">@Html.ActionLink("Checkout", "Checkout", "Cart", new { returnUrl = Request.Url.PathAndQuery }, new { @class="button"})</span></div>
          </div>
</section>